﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using xConnected.Core.Interfaces.Data;
using xConnected.Core.Model;
using System.Data.Entity;

namespace xConnected.Data
{
    public partial class MessageFolderRepository : BaseRepository<MessageFolder>, IMessageFolderRepository
    {
        public override IQueryable<MessageFolder> GetAll()
        {
            return DbSet
                .Include(m => m.Owner)

                .Include(m => m.MessageExpertUsers.Select(e => e.ExpertProfile))
                .Include(m => m.MessageExpertUsers.Select(e => e.Message))
                .Include(m => m.MessageExpertUsers.Select(e => e.Message.MessageExpertUsers))
                .Include(m => m.MessageExpertUsers.Select(e => e.Message.MessageExpertUsers.Select(x => x.ExpertProfile)))
                .Include(m => m.MessageExpertUsers.Select(e => e.Message.MessageCompanyUsers))
                .Include(m => m.MessageExpertUsers.Select(e => e.Message.MessageCompanyUsers.Select(x => x.CompanyProfile)))
                .Include(m => m.MessageExpertUsers.Select(e => e.Message.MessagePositionUsers))
                .Include(m => m.MessageExpertUsers.Select(e => e.Message.MessagePositionUsers.Select(x => x.Position)))

                .Include(m => m.MessageCompanyUsers.Select(e => e.CompanyProfile))
                .Include(m => m.MessageCompanyUsers.Select(e => e.Message))
                .Include(m => m.MessageCompanyUsers.Select(e => e.Message.MessageExpertUsers))
                .Include(m => m.MessageCompanyUsers.Select(e => e.Message.MessageExpertUsers.Select(x => x.ExpertProfile)))
                .Include(m => m.MessageCompanyUsers.Select(e => e.Message.MessageCompanyUsers))
                .Include(m => m.MessageCompanyUsers.Select(e => e.Message.MessageCompanyUsers.Select(x => x.CompanyProfile)))
                .Include(m => m.MessageCompanyUsers.Select(e => e.Message.MessagePositionUsers))
                .Include(m => m.MessageCompanyUsers.Select(e => e.Message.MessagePositionUsers.Select(x => x.Position)))

                .Include(m => m.MessagePositionUsers.Select(e => e.Position))
                .Include(m => m.MessagePositionUsers.Select(e => e.Message))
                .Include(m => m.MessagePositionUsers.Select(e => e.Message.MessageExpertUsers))
                .Include(m => m.MessagePositionUsers.Select(e => e.Message.MessageExpertUsers.Select(x => x.ExpertProfile)))
                .Include(m => m.MessagePositionUsers.Select(e => e.Message.MessageCompanyUsers))
                .Include(m => m.MessagePositionUsers.Select(e => e.Message.MessageCompanyUsers.Select(x => x.CompanyProfile)))
                .Include(m => m.MessagePositionUsers.Select(e => e.Message.MessagePositionUsers))
                .Include(m => m.MessagePositionUsers.Select(e => e.Message.MessagePositionUsers.Select(x => x.Position)));

        }
    }
}
